#ifndef POLYGON_H
#define POLYGON_H

#include <vector>
#include "point.hpp"

// sequence of points + id + closed flag

template <class T>
class Polygon2D : public std::vector<Point<T> >
{
public:
	Polygon2D()
	{
		id = -1;
		closed = false;
	}

	inline Point<T> & operator[](size_t i)
	{
		return std::vector<Point<T> >::operator[](i);
	}

	inline const Point<T> & operator[](size_t i) const
	{
		return std::vector<Point<T> >::operator[](i);
	}

	int  getID() const
	{
		return id;
	}

	void setID(int id)
	{
		this->id = id;
	}

	bool isClosed() const
	{
		return closed;
	}

	void setClosed(bool closed)
	{
		this->closed = closed;
	}

	void set(std::vector<Point<T> >& points)
	{
		static_cast<std::vector<Point<T> >&>(*this) = points;
		id = -1;
		closed = false;
	}

private:
	int  id;
	bool closed;

};

#endif

